<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Organization\Http\Request\Admin;

use Hyperf\Validation\Request\FormRequest;

/**
 * 公司表验证数据类
 */
class RdOrganizeEnterpriseRequest extends FormRequest
{
    /**
     * 场景配置
     */
    protected array $scenes = [
        'index' => [
            'name',
            'icon',
            'created_by',
            'created_at',
            'updated_at',
        ],
        'create' => [
            'name',
            'icon',
            'remark'
        ],
        'update' => [
            'name',
            'icon',
            'remark'
        ]
    ];

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            'name' => 'string|max:255',
            'icon' => 'string|max:255',
            'remark' => 'string|max:255'
        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => '主键',
            'name' => '公司名称',
            'icon' => '图标',
            'remark' => '备注',

        ];
    }

public function messages(): array
{
    return [
            'id.required' => '必填主键',
            'name.required' => '必填公司名称',
            'icon.required' => '必填图标',
            'remark.required' => '必填备注',

    ];
}
}